<%@page import="oocl.eshop.po.Food"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/index.css" rel="stylesheet" type="text/css">
</head>
<body>
<%Object merchant = session.getAttribute("merchant"); %>
	<nav class="navbar navbar-inverse navbar-fixed-top">
	<div class="container-fluid">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed"
				data-toggle="collapse" data-target="#navbar" aria-expanded="false"
				aria-controls="navbar">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="showHomePage">商家平台</a>
		</div>
		<div id="navbar" class="navbar-collapse collapse">
		<ul class="nav navbar-nav navbar-right">
				<li><a href="logout">注销</a></li>
			</ul>
			<form class="navbar-form navbar-right">
				//search <input type="text" class="form-control"
					placeholder="Search...">
			</form>
		</div>
	</div>
	</nav>
	<div class="container contentMin">
		<div class="row">
			<div class="col-md-12">
				<div class="row">
					<!-- 导航 -->
					<div class="col-xs-8 col-sm-3 left-content sidebar-offcanvas"
						id="sidebar">
						<div class="list-group">
							<a href="showHomePage" class="list-group-item">商家信息</a> <a
								href="showFoodPage" class="list-group-item active">菜品管理</a>
						</div>
					</div>
					<!--/.sidebar-offcanvas-->
					<div class="col-xs-8 col-sm-9 col-md-offset-4 right-content">
						<div>
						<h1>菜品管理&nbsp&nbsp<button type="button" class="btn btn-primary btn-sm"
								data-toggle="modal" data-target="#addModal"
								<c:if  test="${merchant.mStatus==1}">disabled="true"</c:if>
								<c:if  test="${merchant.mStatus==3}">disabled="true"</c:if>
								<c:if  test="${merchant.mStatus==4}">disabled="true"</c:if>
								>添加</button></h1>	<span class="error title">${Error} </span>						
						</div>
						<!--  <hr width="100%"> -->
						<div class="table-responsive" style="clear:both">
							<table class="table table-hover menu-table">
								<tr>
									<th>序号</th>
									<th>图片</th>
									<th>菜品名</th>
									<th>价格</th>
									<th>操作</th>
									<th>操作</th>
								</tr>
								<%int i=0; %>
								<c:forEach var="f" items="${foods }">
								<tr><% ++i;%>
									<td><%=i %></td>
									<td><img src="${f.fViewPath }" width="100" height="100"></td>
									<td>${f.fName }</td>
									<td>${f.fPrice }</td>
									<td><a type="button" class="btn btn-primary btn-sm" 
									<c:if  test="${merchant.mStatus==2}">
									href="menuUpdatePage.jsp?thisfViewPath=${f.fViewPath }&thisfName=${f.fName }&thisfPrice=${f.fPrice }&thisfId=${f.fId }" 
									</c:if>
									<c:if  test="${merchant.mStatus==1}">disabled="true" href="javascript:void(0);"</c:if>
								    <c:if  test="${merchant.mStatus==3}">disabled="true" href="javascript:void(0);"</c:if>
								    <c:if  test="${merchant.mStatus==4}">disabled="true" href="javascript:void(0);"</c:if>
								    >修改</a>
										</td>
									<td><a type="button" class="btn btn-primary btn-sm" 
									<c:if  test="${merchant.mStatus==2}">
									href="deleteFood?fId=${f.fId }"
									</c:if>
									<c:if  test="${merchant.mStatus==1}">disabled="true" href="javascript:void(0);"</c:if>
								    <c:if  test="${merchant.mStatus==3}">disabled="true" href="javascript:void(0);"</c:if>
								    <c:if  test="${merchant.mStatus==4}">disabled="true" href="javascript:void(0);"</c:if>
									>删除</a></td>
								</tr></c:forEach>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- 修改摸态框 -->
	
	<!-- 添加摸态框 -->
	<div id="addModal" class="modal fade editModal" tabindex="-1"
		role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">添加菜品</h4>
				</div>
				<form method="post" action="addFood" enctype="multipart/form-data">
					<div class="modal-body">
						<div class="form-group">
							<label>菜品名</label> <input type="text" class="form-control"
								placeholder="菜品名" name="fName">
						</div>
						<div class="form-group">
							<label>价格</label> <input type="text" class="form-control"
								placeholder="价格" name="fPrice">
						</div>
						<div class="form-group">
							<label>菜品图片</label> <input type="file"  id="inputfile" class="btn-primary" 
								placeholder="菜品图片" name="fViewPath">
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						<button type="submit" class="btn btn-primary editAccount">提交</button>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</html>